<%@ page language="java" pageEncoding="UTF-8"%>
<%@include file="/common/common.jsp" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <style type="text/css">
	BODY,TD {FONT-FAMILY: "宋体"; FONT-SIZE: 10pt;line-height: 15px} 
	</style>
	<script type='text/javascript' src='${pageContext.request.contextPath}/dwr/interface/salescardService.js'></script>
	<script type='text/javascript' src='${pageContext.request.contextPath}/dwr/engine.js'></script>
	<script type='text/javascript' src='${pageContext.request.contextPath}/dwr/util.js'></script>
	<script type="text/javascript">
		function addSalescard(field) {
			//if checked addormodiy item ,or delete
			var res = field.attributes['resource'].nodeValue;
			if(field.checked) {
				//alert(res);
				$("cb_"+res).checked = true;
				salescardService.addSalescard(
					res,
					"${salesdeptdetail.salesdetailno}",
					0
				);
				$("tr_"+res).style.display="none"
			} 
		}
		
		function delSalescard(field) {
			//if checked addormodiy item ,or delete
			var res = field.attributes['resource'].nodeValue;
			if(field.checked) {
				//alert(res);
				$("cb_"+res).checked = true;
				salescardService.removeSalescard(
					res
				);
				$("tr_"+res).style.display="none"
			} 
		}
		
		function findCardinfoSalesdetailSelected() {
			var f1 = document.getElementById('findCardinfoForSalesdetailno');
			f1.action = "findCardinfoSalesdetailSelected.action";
			f1.submit();
		}
	</script>
    <title>show salesdeptdetail</title>
  </head>
  <body bgcolor="#ccddee" link="#000066" vlink="#0066FF" alink="#99FF00">
    <br>
		<h3>入库单明细选卡</h3>
		<fieldset><legend>基本信息</legend>
		<table width="100%" border=1 align="center" cellpadding="0" cellspacing="0" bgcolor="#ccddee" ><tr>
			<td width="200">编号：${salesdeptdetail.salesdetailno}</td>
			<td width="200">子卡类型:${salesdeptdetail.cardsubtype.cardsubtypename}</td>
		</tr>
		<tr>
			<td width="200">总金额: ${salesdeptdetail.totalmoney}</td>
			<td >总数量:${salesdeptdetail.totalsum}</td>
		</tr></table>
		<s:form method="post" namespace="/workflow" theme="simple" action="findCardinfoForSalesdetailno" >
		<table width="100%" border="0">
		<tr>
			<td width="15%" align="right">
				基本类型:
			</td>
			<td width="20%">
				<s:select name="datadictByBasetype.typeid" list="datadictByBasetypelist" 
						listKey="typeid" 
						listValue="name"
						headerKey="0" headerValue="请选择类型"
						theme="simple"></s:select>
			</td>
			<td width="15%" align="right">
				地域类型:
			</td>
			<td width="20%">
				<s:select name="datadictByAreatype.typeid" list="datadictByAreatypelist" 
						listKey="typeid" 
						listValue="name"
						headerKey="0" headerValue="请选择类型"
						theme="simple"></s:select>
			</td>
			<td align="left">
				<s:hidden name="salesdetailno" ></s:hidden>
			</td>
		</tr>
		<tr>
			<td width="15%" align="right">
				功能类型:
			</td>
			<td width="20%">
				<s:select name="datadictByFuntype.typeid" list="datadictByFuntypelist" 
						listKey="typeid" 
						listValue="name"
						headerKey="0" headerValue="请选择类型"
						theme="simple"></s:select>
			</td>
			<td width="15%" align="right">
				金额:
			</td>
			<td width="20%">
				<s:textfield name="money" theme="simple" required="true"></s:textfield>
			</td>
			<td align="left">
				<s:submit value="选卡"></s:submit>
				<s:if test="!selected">
				<input type="button" value="查看已选卡号" onclick = "findCardinfoSalesdetailSelected()">
				</s:if>
			</td>
		</tr>
		</table>
		</s:form>
		</fieldset>
		<fieldset>
		<legend>
		<s:if test="selected">已选</s:if>
		<s:if test="!selected">备选</s:if>卡列表</legend>
		<table width="100%" border=1 align="center" cellpadding="0" cellspacing="0" bgcolor="#ccddee" >
				<tr>
			        <td align="center">
			        	<s:if test="selected">删除</s:if>
			        	<s:if test="!selected">选择</s:if>
			        </td>
			        <td align="center">编号</td>
			        <td align="center">基本类型</td>
			        <td align="center">地域类型</td>
			        <td align="center">功能类型</td>
			        <td align="center">面额</td>
      			</tr>
      			<s:iterator value="pm.datas" status="rowstatus" var="cardinfo">
      				<tr <s:if test="#rowstatus.odd == true">bgcolor="white"</s:if> id="tr_<s:property value="cardno"/>">
	      				<td align="center" >
	      					<s:if test="selected">
	      						<input type="checkbox" id="cb_<s:property value="cardno"/>" resource="<s:property value="cardno"/>" name="cardno" value="<s:property value="cardno"/>"
	      							 onclick="delSalescard(this)"/>
	      					</s:if>
	      					<s:if test="!selected">
	      						<input type="checkbox" id="cb_<s:property value="cardno"/>" resource="<s:property value="cardno"/>" name="cardno" value="<s:property value="cardno"/>"
	      							 onclick="addSalescard(this)"/>
	      					</s:if>
	      				</td>
				        <td align="center">
				        	<s:property value="cardno"/>
				        </td>
				        <td align="center">
				        	<s:property value="#cardinfo.datadictByBasetype.name"/>
				        </td>
				        <td align="center">
				        	<s:property value="#cardinfo.datadictByAreatype.name"/>
				        </td>
				        <td align="center">
				        	<s:property value="#cardinfo.datadictByFuntype.name"/>
				        </td>
			        	<td align="center">
			        		<s:property value="money"/>
			        	</td>
			        </tr>
				</s:iterator>
				<tr>
					<td colspan="8" align="center">
				<pg:pager url="${url}" items="${pm.total }" export="offset,currentPageNumber=pageNumber">
					<pg:param name="salesdetailno" value="${salesdeptdetail.salesdetailno}"/>
					<pg:param name="money" value="${money}"/>
					<pg:param name="datadictByBasetype.typeid" value="${datadictByBasetype.typeid}"/>
					<pg:param name="datadictByAreatype.typeid" value="${datadictByAreatype.typeid}"/>
					<pg:param name="datadictByFuntype.typeid" value="${datadictByFuntype.typeid}"/>
					<pg:first>
						<a href="${pageUrl }">首页</a>
					</pg:first>
					<pg:prev>
						<a href="${pageUrl }">前页</a>
					</pg:prev>
					<pg:pages>
						<c:choose>
							<c:when test="${currentPageNumber eq pageNumber}">
								<font color="red">${pageNumber }</font>
							</c:when>
							<c:otherwise>
								<a href="${pageUrl }">${pageNumber }</a>
							</c:otherwise>
						</c:choose>
					</pg:pages>
					<pg:next>
						<a href="${pageUrl }">后页</a>
					</pg:next>
					<pg:last>
						<a href="${pageUrl }">尾页</a>
					</pg:last>
				</pg:pager>
					</td>
				</tr>
      		</table>
		</fieldset>
		<br>
</body>
</html>
